package com.jinmdz.fmis.core.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jinmdz.fmis.core.base.BaseBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * Select.Option.Item
 *
 * @author LiCongLu
 * @date 2020-01-19 09:45
 */
@ApiModel(value = "子行政区划选项Item", description = "子行政区划选项Item")
public class OptionItem extends BaseBean implements Comparable<OptionItem> {
    /**
     * 主键
     */
    @ApiModelProperty(value = "主键", name = "id", position = 1)
    @JsonIgnore
    private Integer id;

    /**
     * 数值
     */
    @ApiModelProperty(value = "数值", name = "value", position = 2)
    private Object value;

    /**
     * 标签
     */
    @ApiModelProperty(value = "标签", name = "label", position = 3)
    private String label;

    /**
     * 标签缩写
     */
    @ApiModelProperty(value = "标签缩写", name = "abbr", position = 4)
    private String abbr;

    /**
     * 禁用状态
     */
    @ApiModelProperty(value = "禁用状态", name = "disabled", position = 5)
    private Integer disabled;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序", name = "sort", position = 6)
    @JsonIgnore
    private Integer sort;

    public Integer getId() {
        return id;
    }

    public OptionItem setId(Integer id) {
        this.id = id;
        return this;
    }

    public Object getValue() {
        return value;
    }

    public OptionItem setValue(Object value) {
        this.value = value;
        return this;
    }

    public String getLabel() {
        return label;
    }

    public OptionItem setLabel(String label) {
        this.label = label;
        return this;
    }

    public String getAbbr() {
        return abbr;
    }

    public OptionItem setAbbr(String abbr) {
        this.abbr = abbr;
        return this;
    }

    public Integer getDisabled() {
        return disabled;
    }

    public OptionItem setDisabled(Integer disabled) {
        this.disabled = disabled;
        return this;
    }

    public Integer getSort() {
        return sort;
    }

    public OptionItem setSort(Integer sort) {
        this.sort = sort;
        return this;
    }

    @Override
    public int compareTo(OptionItem o) {
        if (o == null || o.sort == null) {
            return 1;
        }

        if (this.sort == null) {
            return -1;
        }

        if (this.sort.intValue() == o.sort.intValue()) {
            return 0;
        }
        return this.sort.intValue() > o.sort.intValue() ? 1 : -1;
    }
}
